package cn.tx.controller;

import java.util.List;

import cn.tx.model.ConsoleLog;
import cn.tx.query.ConsoleLogQuery;
import cn.tx.service.ConsoleLogService;
import cn.tx.util.Page;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ModelDriven;

public class ConsoleLogAction extends BaseAction implements ModelDriven<ConsoleLog>{
	
	private ConsoleLog consoleLog = new ConsoleLog();
	
	private ConsoleLogService consoleLogService;
	
	
	
	
	public ConsoleLog getConsoleLog() {
		return consoleLog;
	}

	public void setConsoleLog(ConsoleLog consoleLog) {
		this.consoleLog = consoleLog;
	}

	/**
	 * 查询对象
	 */
	private ConsoleLogQuery erpQuery = new ConsoleLogQuery();
	
	
	public ConsoleLogService getConsoleLogService() {
		return consoleLogService;
	}

	public void setConsoleLogService(ConsoleLogService consoleLogService) {
		this.consoleLogService = consoleLogService;
	}
	

	public ConsoleLogQuery getErpQuery() {
		return erpQuery;
	}

	public void setErpQuery(ConsoleLogQuery erpQuery) {
		this.erpQuery = erpQuery;
	}

	/**
	 * 查询员工的列表
	 * @return
	 */
	public String consoleLog_list(){
		//获得action的容器
		ActionContext context = ActionContext.getContext();
		Page page = consoleLogService.selectObjectByConditionPage(erpQuery, exclude);
		context.put("page", page);
		
		return SUCCESS;
	}
	
	public String consoleLog_logList(){
		//获得action的容器
		ActionContext context = ActionContext.getContext();
		List<ConsoleLog> list = consoleLogService.selectObjByCondition(erpQuery, exclude);
		context.put("logList", list);
		
		return SUCCESS;
	}
	
	/**
	 * 跳转到添加页面
	 * @return
	 */
	public String consoleLog_input(){
		
		return SUCCESS;
	}
	/**
	 * 跳转到修改页面
	 * @return
	 */
	public String consoleLog_preupdate(){
		consoleLog = consoleLogService.getObjectById(consoleLog.getLogId());
		return SUCCESS;
	}
	/**
	 * 保存
	 * @return
	 */
	public String consoleLog_save(){
		consoleLogService.save(consoleLog);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String consoleLog_update(){
		consoleLogService.update(consoleLog);
		return TOLIST;
	}
	/**
	 * 修改
	 * @return
	 */
	public String consoleLog_delete(){
		consoleLog = consoleLogService.getObjectById(consoleLog.getLogId());
		consoleLogService.delete(consoleLog);
		return TOLIST;
	}

	@Override
	public ConsoleLog getModel() {
		return consoleLog;
	}
	
	
	
	

}
